package utils

import org.apache.spark.sql.Row

/**
  * Created by 王康 on 2018/6/30.
  */
object CleanDataUtils {
  def cleanDataByAppNameCore(row: Row): (Double, Double, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean) = {
    val requestmode: Int = row.getInt(8)
    val processnode: Int = row.getInt(35)
    val iseffective: Int = row.getInt(30)
    val isbilling: Int = row.getInt(31)
    val isbid: Int = row.getInt(39)
    val iswin: Int = row.getInt(42)
    val adorderid: Int = row.getInt(2)
    val winprice: Double = row.getDouble(41)
    val adpayment: Double = row.getDouble(75)

    val flag1: Boolean = requestmode == 1 && processnode >= 1
    val flag2 = requestmode == 1 && processnode >= 2
    val flag3 = requestmode == 1 && processnode == 3
    val flag4 = iseffective == 1 && isbilling == 1 && isbid == 1 && adorderid != 0
    val flag5 = iseffective == 1 && isbilling == 1 && iswin == 1
    val flag6 = requestmode == 2 && iseffective == 1
    val flag7 = requestmode == 3 && iseffective == 1
    (winprice, adpayment, flag1, flag2, flag3, flag4, flag5, flag6, flag7)
  }
}
